﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title></title>
</head>
<body>

  <script type="text/javascript" src="js/jquery.js" language="javascript"></script>

  <ul>
    <li><a></a></li>
    <li><a></a></li>
    <li><a></a></li>
    <li><a></a></li>
    <li><a></a></li>
    <li><a></a></li>
  </ul>
  <input type="button" id="submitButton" value="提交" />

  <form action="/login" id="loginForm">
    <table border="0" cellpadding="5" cellspacing="0">
      <tr>
        <td>用户名:</td>
        <td><input type="text" name="username" style="width: 100px;" required="required" /></td>
      </tr>
      <tr>
        <td>密码:</td>
        <td><input type="password" name="password" style="width: 100px;" required="required" /></td>
      </tr>
      <tr>
        <td>验证码:</td>
        <td><input type="text" name="validateCode" style="width: 50px;" required="required" /><img src="validateCode.img" /></td>
      </tr>
      <tr>
        <td colspan="2"><input type="submit" value="登陆" /></td>
      </tr>
    </table>
  </form>

  <script type="text/javascript">

    $("form").submit(function ()
    {
      var flag = true;

      $(this).find("input[type=text][required=required] , input[type=password][required=required]").each(function ()
      {
        if ($(this).val() == "")
        {
          window.alert("信息没有填写完整，请认真检查必填项");
          flag = false;
          return false;
        }
      });

      return flag;

    });


    /*
    $("form#loginForm input[type=submit]").click(function ()
    {
    var form = $("form#loginForm");
    var flag = true;
    form.find("input[name=username] , input[name=password] , input[name=validateCode]").each(function ()
    {
    if (this.value == "" && flag)
    {
    window.alert("请将登陆信息填写完整");
    flag = false;
    }
    });

    return flag;
    });
    */

    $("#submitButton").click(function () { if (confirm('您确定要提交这些信息么')) $('#registerForm').submit(); });

    var items = document.getElementsByTagName("li");
    for (var i = 0; i < items.length; i++)
    {
      var li = items.item(i);
      li.style.fontStyle = "italic";
      li.style.display = "";

      var childs = li.childNodes;
      for (var j = 0; j < childs.length; j++)
      {
        var a = childs[j];

        if (a.tagName != "A")
          continue;

        a.innerText = "删除";
        a.href = "javascript:void(0);";

        a.onclick = function ()
        {
          this.parentNode.style.display = "none";
        };
      }
    }
  </script>

</body>
</html>
